// The New Guncaster Blood code, Written by Dinosaur Nerd.
// Pillowblaster helped nitpick this stuff to ensure it looks nice and pretty.
// That's rite baybee!!

// Pillow: I am gonna nitpick a bit further now.

class GC_TinyBlood : Actor
{
	Default
	{
		BounceFactor 0.01;
		Scale 0.2;
		Speed 7;
		Radius 8;
		Height 1;
		Gravity 0.7;
		Decal "BrutalBloodSplat";
		+DONTSPLASH
		+MISSILE
		+PAINLESS
		+CLIENTSIDEONLY
		+NOTELEPORT
		+NOBLOCKMAP
		+FORCEXYBILLBOARD
		-EXPLODEONWATER
		+DOOMBOUNCE
		+NOTONAUTOMAP
	}
	
    States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(Waterlevel > 1, "Null");
        BLUD Z 500;
		Stop;
	Death:
		XDT1 EFGHIJKL 2;
        Stop;
    }
}

class PGC_TinyBlood : GC_TinyBlood
{
	Default
	{
		BloodColor "Purple";
		Decal "PurpleBloodSplat";
	}
}

class BGC_TinyBlood : GC_TinyBlood
{
	Default
	{
		BloodColor "Blue";
		Decal "BlueBloodSplat";
	}
}

class BloodHeightDetector : GC_TinyBlood //Doesn't spawns blood pools if it hits the ceiling or walls.
{
	Default
	{
		Scale 1.0;
		Gravity 1.0;
		+EXPLODEONWATER
	}
	
    States
    {
    Spawn:
		TNT1 A 0 NoDelay {
			ThrustThingZ(0,25,1,0);
			Return A_JumpIf(Waterlevel > 1, "Null");
		}
        BLBD C 3;
        Stop;
	Death:
		TNT1 A 0 {
			A_SpawnItemEx("GC_BloodSpot",0,0,0,0,0,0,0,SXF_TRANSFERTRANSLATION);
			A_PlaySound("blooddrop");
		}
		XDT1 EFGHIJK 3;
        Stop;
    }
}

class DripingBlood : GC_TinyBlood
{
	Default
	{
		Scale 0.3;
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(Waterlevel > 1, "Null");
		BLUD Z 4;
		Loop;
	Death:
		TNT1 A 0 A_PlaySound("blooddrop");
		XDT1 EFGHIJKL 2;
		Stop;
	}
}

class DripingBloodLeavesSmallPool : GC_TinyBlood
{
	Default
	{
		Scale 0.3;
		-DONTSPLASH;
	}
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(Waterlevel > 1, "Null");
		BLUD Z 4;
		Loop;
	Death:
		TNT1 A 0 {
			A_SpawnItemEx("MinuscleBloodSpot",0,0,0,0,0,0,0,SXF_TRANSFERTRANSLATION);
			A_PlaySound("blooddrop");
		}
		XDT1 EFGHIJKL 2;
        Stop;
    }
}

class GC_FlyingBloodTrailSpawner : Actor
{
	Default
	{
		Mass 5;
		Decal "BrutalBloodSplat";
		+NOBLOCKMAP
		+NOTELEPORT
		+FORCEXYBILLBOARD
		+GHOST
		+NOGRAVITY
		+NOCLIP
		+EXPLODEONWATER
		-ALLOWPARTICLES 
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(Waterlevel > 1, "Splash");
		TNT1 A 0 A_SpawnItemEx("GC_FlyingBloodTrail",0,0,0,frandom(1.0,0.5)*random(1,-1),0,frandom(1.0,0.5),frandom(0.0,180.0),
			SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_TRANSFERTRANSLATION);
		Stop;
	Splash:
		TNT1 A 0 {
			For(int bazinga = 0; bazinga < 4; bazinga++) {
				A_SpawnItemEx("SuperGoreUnderwater",0,0,0,frandom(1.0,0.5)*random(1,-1),0,frandom(1.0,0.5),frandom(0.0,360.0),
					SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_TRANSFERTRANSLATION);
			}
		}
		Stop;
	}
}

class PGC_FlyingBloodTrailSpawner : GC_FlyingBloodTrailSpawner
{
	Default
	{
		BloodColor "Purple";
		Decal "PurpleBloodSplat";
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_JumpIf(Waterlevel > 1, "Splash");
			A_SpawnItemEx("PGC_FlyingBloodTrail",0,0,0,frandom(1.0,0.5)*random(1,-1),0,frandom(1.0,0.5),frandom(0.0,180.0),
				SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_TRANSFERTRANSLATION);
		}
        Stop;
	}
}

class BGC_FlyingBloodTrailSpawner : GC_FlyingBloodTrailSpawner
{
	Default
	{
		BloodColor "Blue";
		Decal "BlueBloodSplat";
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_JumpIf(Waterlevel > 1, "Splash");
			A_SpawnItemEx("BGC_FlyingBloodTrail",0,0,0,frandom(1.0,0.5)*random(1,-1),0,frandom(1.0,0.5),frandom(0.0,180.0),
				SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_TRANSFERTRANSLATION);
		}
        Stop;
	}
}

class TraditionalBlood : Blood
{
	States
	{
	Spawn:
		BLUD FED 8;
		Stop;
	}
}

class BloodDoshSpawner : RandomSpawner
{
	Default
	{
		DropItem "Dosh1", 224;
		DropItem "Dosh5", 8;
		DropItem "Dosh10", 4;
	}
}

class GC_FlyingBlood : Actor
{
	Default
	{
		Radius 8;
		Height 1;
		Scale 0.9;
		Health 1;
		Gravity 0.9;
		Renderstyle "Translucent";
		Decal "BrutalBloodSplat";
		Alpha 0.95;
		+MISSILE
		+PAINLESS
		+CLIENTSIDEONLY
		+NOTELEPORT
		+NOBLOCKMAP
		+THRUACTORS
		+BLOODLESSIMPACT 
		+FORCEXYBILLBOARD
		+NODAMAGETHRUST
		+MOVEWITHSECTOR
		+CORPSE
		+DONTSPLASH
		+EXPLODEONWATER
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(GetCVar("GC_Loadsamoney"), "Moolah");
		BLBD A 1;
		BLBD BC 2;
		TNT1 A 0 A_JumpIf(Waterlevel > 1, "Splash");
	Loopler:
		BLBD E 6;
		Loop;
	Splash:
		BLBD A 0;
		Stop;
	Death:
		TNT1 A 0 {
			A_PlaySound("blooddrop");
			A_SpawnItemEx("BloodHeightDetector",0,0,0,0,0,0,0,SXF_TRANSFERTRANSLATION);
			for(int borf = 0; borf < 4; borf++) {
				A_SpawnItemEx("GC_CrushBlood",0,0,0,frandom(1.0,0.5)*random(1,-1),0,frandom(1.0,0.5),frandom(0.0,360.0),
					SXF_NOCHECKPOSITION|SXF_TRANSFERPITCH|SXF_TRANSFERPOINTERS|SXF_TRANSFERTRANSLATION);
			}
		}
		TNT1 A 1 A_CheckCeiling(1);
		Stop;
		TNT1 A 1 A_SpawnItemEx("CeilBloodSpot",0,0,0,1,0,0,0,SXF_TRANSFERTRANSLATION);
		Stop;
	Moolah:
		TNT1 A 0 A_DropItem("BloodDoshSpawner");
		Stop;
	}
}

class PGC_FlyingBlood : GC_FlyingBlood
{
	Default
	{
		BloodColor "Purple";
		Decal "PurpleBloodSplat";
	}
}

class BGC_FlyingBlood : GC_FlyingBlood
{
	Default
	{
		BloodColor "Blue";
		Decal "BlueBloodSplat";
	}
}

class GC_BloodSpot : Actor
{
	Default
	{
		Radius 1;
		Height 1;
		Mass 0;
		Scale 0.5;
		Renderstyle "Translucent";
		Decal "BrutalBloodSplat";
		Alpha 0.93;
		+NOTELEPORT
		+NOBLOCKMAP
		+CLIENTSIDEONLY
		+FORCEXYBILLBOARD
		+MOVEWITHSECTOR
		+FLOORCLIP
		+MISSILE
		+DONTSPLASH
		+EXPLODEONWATER
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 0;
	Death:
	Crash:
		TNT1 A 0 A_JumpIf(Waterlevel > 1, "Null");
		BPDL A 4500 A_QueueCorpse;
		Stop;
	}
}

class PGC_BloodSpot : GC_BloodSpot
{
	Default
	{
		BloodColor "Purple";
		Decal "PurpleBloodSplat";
	}
}

class BGC_BloodSpot : GC_BloodSpot
{
	Default
	{
		BloodColor "Blue";
		Decal "BlueBloodSplat";
	}
}

class MinuscleBloodSpot: GC_BloodSpot
{
	Default
	{
		Scale 0.25;
	}
}

class CeilBloodSpot : ZCeilingCat
{
	Default
	{
		Scale 0.5;
		Radius 1;
		Height 1;
		Mass 0;
		RenderStyle "Translucent";
		Alpha 0.93;
		Decal "BrutalBloodSplat";
		+NOTELEPORT
		+NOBLOCKMAP
		+CLIENTSIDEONLY
		+FORCEXYBILLBOARD
		+FLOORCLIP
		+EXPLODEONWATER
		+NOTONAUTOMAP
		+SPAWNCEILING
		+MOVEWITHSECTOR
		+NOGRAVITY
		+DONTSPLASH
		+MISSILE
	}
	
	int user_ass;
	
	States
	{
	Spawn:
		TNT1 A 0;
	Death:
	Crash:
		BPDL A 30 A_SpawnItemEx("DripingBloodLeavesSmallPool",0,0,0,0,0,0,0,SXF_TRANSFERTRANSLATION);
		BPDL A 60 {
			A_SpawnItemEx("GC_TinyBlood",0,0,0,0,0,0,0,SXF_TRANSFERTRANSLATION);
			A_SetTics(Random(70,105)); // Pillow: 60 is not a second, 35 in tics is.
			user_ass = 0;
		}
	Loopler:
		BPDL A 60 {
			A_SpawnItemEx("GC_TinyBlood",0,0,0,0,0,0,0,SXF_TRANSFERTRANSLATION);
			A_SetTics(Random(70,105));
			user_ass++;
			Return A_JumpIf(user_ass > 6,"Null");
		}
		Loop;
	}
}

class PCeilBloodSpot : CeilBloodSpot
{
	Default
	{
		BloodColor "Purple";
		Decal "PurpleBloodSplat";
	}
}

class BCeilBloodSpot : CeilBloodSpot
{
	Default
	{
		BloodColor "Blue";
		Decal "BlueBloodSplat";
	}
}

class GiantBloodSpot: GC_BloodSpot
{
	Default
	{
		Mass 1;
		BounceFactor 0.01;
		+DOOMBOUNCE
		-DONTSPLASH
		-EXPLODEONWATER
	}
	
	States
	{
	Spawn:
		TNT1 A 0;
	Death:
	Crash:
		TNT1 A 0 A_JumpIf(Waterlevel > 1, "Null");
		BPDL A 5000 A_QueueCorpse;
		Stop;
	}
}

class MediumBloodSpot: GiantBloodSpot
{
	States
	{
	Spawn:
		TNT1 A 0;
	Death:
	Crash:
		TNT1 A 0 A_JumpIf(Waterlevel > 1, "Splash");
		BPDL A 8 A_QueueCorpse();
		BPDL A 5000;
		Stop;
	}
}

// AHAHA HAHAHAHA HAHAHAHAHAHAHHAA. -Dino

class GC_GrowingBloodPool : Actor
{
	Default
	{
		Radius 1;
		Height 1;
		Mass 1;
		Renderstyle "Normal";
		Alpha 0.99;
		Scale 0.09;
		+THRUACTORS
		+NOTARGET
		+NOBLOOD
		+NOTELEPORT
		+CLIENTSIDEONLY
		+FORCEXYBILLBOARD
		+MOVEWITHSECTOR
		+FLOORCLIP
		+DONTTHRUST
		+MISSILE
		+DONTSPLASH
	}
	
	float user_turd;
	float user_crapper;
	
	States
	{
	Spawn:
		BPDL A 2 NoDelay {
			A_QueueCorpse();
			user_turd = 0;
			user_crapper = 0.01;
			Return A_JumpIf(Waterlevel > 1, "Null");
		}
	Loopler:
		BPDL A 1 {
			if(user_crapper > 0.0001) { user_crapper - 0.0001; }
			A_SetScale(Scale.X + user_crapper);
			Return A_JumpIf(Scale.X >= 1.7, "TheEnd");
		}
		Loop;
	TheEnd:
		BPDL A -1;
		Stop;
	Death:
		TNT1 A 0 A_NoBlocking();
		Stop;
	}
}

class PGC_GrowingBloodPool :  GC_GrowingBloodPool
{
	Default
	{
		BloodColor "Purple";
	}
}

class BGC_GrowingBloodPool :  GC_GrowingBloodPool
{
	Default
	{
		BloodColor "Blue";
	}
}
	

class CeilBloodLauncherLong : Actor
{
	Default
	{
		Speed 15;
		Decal "BrutalBloodSplat";
		+THRUACTORS
		+BLOODLESSIMPACT
		+NOGRAVITY
	}
	
	States
	{
	Spawn:
		TNT1 A 1 NoDelay A_JumpIf(Waterlevel > 1, "Null");
		Stop;
	Death:
		TNT1 A 0 A_CheckCeiling(1);
		Stop;
		TNT1 A 1 A_SpawnItemEx("CeilBloodSpot",0,0,0,1,0,0,0,SXF_TRANSFERTRANSLATION);
		Stop;
	XDeath:
		TNT1 A 1;
		Stop;
	}
}

class PCeilBloodLauncherLong : CeilBloodLauncherLong
{
	Default
	{
		BloodColor "Purple";
		Decal "PurpleBloodSplat";
	}
}

class BCeilBloodLauncherLong : CeilBloodLauncherLong
{
	Default
	{
		BloodColor "Blue";
		Decal "BlueBloodSplat";
	}
}

// Blood trails spawned by FlyingBlood
class GC_FlyingBloodTrail : Actor
{
	Default
	{
		Mass 0;
		Scale 0.7;
		Alpha 0.7;
		Speed 2;
		Renderstyle "Translucent";
		Decal "BrutalBloodSplat";
		+PAINLESS
		+LOWGRAVITY
		+NOTELEPORT
		+NOBLOCKMAP
		+NOCLIP
		+FORCEXYBILLBOARD
		+CLIENTSIDEONLY
		+DONTSPLASH
		+MISSILE
		-NOGRAVITY
		+NOTONAUTOMAP
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(Waterlevel > 1, "Null");
		BLBD ABCDDEEFFF 4;
		Stop;
	Death:
		TNT1 A 0;
		Stop;
	}
}

class PGC_FlyingBloodTrail : GC_FlyingBloodTrail
{
	Default
	{
		BloodColor "Purple";
		Decal "PurpleBloodSplat";
	}
}

class BGC_FlyingBloodTrail : GC_FlyingBloodTrail
{
	Default
	{
		BloodColor "Blue";
		Decal "BlueBloodSplat";
	}
}

class GC_MainBlood : Actor	// : GC_FlyingBloodTrail
{
	Default
	{
		Speed 2;
		Alpha 1.0;
		Gravity 0.3;
		Scale 0.5;
		+NOGRAVITY
		+THRUACTORS
	}
	
	States
	{
	Spawn:
		BLER G 1 A_FadeOut(0.07);
		Loop;
	Death:
		TNT1 A 0;
		Stop;
	}
}

class BGC_MainBlood : GC_MainBlood
{
	Default
	{
		BloodColor "Purple";
		Decal "PurpleBloodSplat";
	}
}

class PGC_MainBlood : GC_MainBlood
{
	Default
	{
		BloodColor "Blue";
		Decal "BlueBloodSplat";
	}
}
 
class SuperGoreUnderwater : GC_FlyingBloodTrail
{
	Default
	{
		Speed 1;
		Alpha 1.0;
		Gravity 0.3;
		Scale 0.7;
		+NOGRAVITY
		+THRUACTORS
	}
	
	States
	{
	Spawn:
		BLER G 1 A_FadeOut(0.02);
		Stop;
	Death:
		TNT1 A 0;
		Stop;
	}
}

class PSuperGoreUnderwater : SuperGoreUnderwater
{
	Default
	{
		BloodColor "Purple";
		Decal "PurpleBloodSplat";
	}
}

class BSuperGoreUnderwater : SuperGoreUnderwater
{
	Default
	{
		BloodColor "Blue";
		Decal "BlueBloodSplat";
	}
}

class GC_CrushBlood : GC_FlyingBloodTrail	// BloodTr255
{
	Default
	{
		Speed 2;
		Alpha 0.5;
		Scale 1.0;
		Gravity 0.3;
		-NOGRAVITY
		+THRUACTORS
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(Waterlevel > 1, "Null");
		BTRL ABCD 3;
		Stop;
	Death:
		TNT1 A 0;
		Stop;
	}
}

class GC_WallBlood : Actor //SuperWallRedBlood
{
	Default
	{
		Radius 8;
		Height 1;
		Gravity 0.1;
		Scale 0.6;
		Decal "BrutalBloodSuper";
		+MISSILE
		+CLIENTSIDEONLY
		+NOTELEPORT
		+NOBLOCKMAP
		+BLOODLESSIMPACT 
		+THRUACTORS
	}
	
    States
    {
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(Waterlevel > 1, "Null");
		TNT1 A 4;
		Stop;
	Death:
		TNT1 A 3;
		stop;
    }
}

class PGC_WallBlood : GC_WallBlood
{
	Default
	{
		BloodColor "Purple";
		Decal "PurpleBloodSuper";
	}
}

class BGC_WallBlood : GC_WallBlood
{
	Default
	{
		BloodColor "Blue";
		Decal "BlueBloodSuper";
	}
}